#! /bin/bash

commit() {
  git add *
  git commit -m "update" -a
  git push origin master
}

main() {
  cd ..

  all_dir=$(find . -maxdepth 1 -type d)
  
  if [ ${#all_dir} -lt 2 ]
  then
    echo Previous directory not valid directory.
    exit 1
  fi

  for dir in ${all_dir}
  do
    [[ ${dir} == "." ]] && continue
    cd ${dir}
    commit
    cd ..
  done
}

main

